﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:ESRI.ArcGIS.Client.Toolkit">

	<Style TargetType="local:MapTip">
		<Setter Property="HorizontalOffset" Value="20" />
		<Setter Property="VerticalOffset" Value="30" />
		<Setter Property="Background" Value="White" />
		<Setter Property="BorderThickness" Value="1" />
		<Setter Property="BorderBrush" Value="#FF666666" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:MapTip"
					xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
					>
					<Grid x:Name="MapTip" MinWidth="50" >
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">

								<VisualState x:Name="Collapsed">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MapTipData" Storyboard.TargetProperty="Height">
											<SplineDoubleKeyFrame KeyTime="00:00:00.5" Value="0" KeySpline="0.3,0 0,1" />
										</DoubleAnimationUsingKeyFrames>
										<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MapTipData" Storyboard.TargetProperty="Width">
											<SplineDoubleKeyFrame KeyTime="00:00:00.5" Value="0" KeySpline="0.3,0 0,1" />
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>

								<VisualState x:Name="Expanded">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MapTipData" Storyboard.TargetProperty="Height">
											<SplineDoubleKeyFrame KeyTime="00:00:00.5" Value="150" KeySpline="0.3,0 0,1" />
										</DoubleAnimationUsingKeyFrames>
										<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MapTipData" Storyboard.TargetProperty="Width">
											<SplineDoubleKeyFrame KeyTime="00:00:00.5" Value="200" KeySpline="0.3,0 0,1" />
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>

							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>

						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition Height="20" />
							<RowDefinition Height="*" />
						</Grid.RowDefinitions>

						<Border CornerRadius="5" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.RowSpan="2" />
						<Polyline Points="0,10 -10,-10 10,0" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Fill="{TemplateBinding Background}" />

						<ContentPresenter Margin="5,5,5,0" Content="{TemplateBinding Title}" />

						<data:DataGrid HeadersVisibility="None" ItemsSource="{TemplateBinding ItemsSource}" 
							x:Name="MapTipData" Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" AlternatingRowBackground="White"
							Height="0" Width="0" AutoGenerateColumns="True" />
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>
